In [ ]:
%matplotlib inline

from matplotlib import pyplot as plt
import numpy
import csv

In [ ]:
data = open('../data/data.csv', 'r').readlines()
fieldnames = ['x', 'y', 'z', 'unmasked', 'synapses']
reader = csv.reader(data)
reader.next()

rows = [[int(col) for col in row] for row in reader]

In [3]:
x = list([r[0] for r in rows])
y = list([r[1] for r in rows])
z = list([r[2] for r in rows])

sorted_x = sorted(list(set([r[0] for r in rows])))
sorted_y = sorted(list(set([r[1] for r in rows])))
sorted_z = sorted(list(set([r[2] for r in rows])))

print len(sorted_x)
print len(sorted_y)
print len(sorted_z)

print sorted_x
print sorted_y
print sorted_z

print len(x)
#print len(y)
#print len(z)

#print x
#print y
#print z


108
52
11
[19, 58, 97, 136, 175, 214, 253, 292, 331, 370, 409, 448, 487, 526, 565, 604, 643, 682, 721, 760, 799, 838, 877, 916, 955, 994, 1033, 1072, 1111, 1150, 1189, 1228, 1267, 1306, 1345, 1384, 1423, 1462, 1501, 1540, 1579, 1618, 1657, 1696, 1735, 1774, 1813, 1852, 1891, 1930, 1969, 2008, 2047, 2086, 2125, 2164, 2203, 2242, 2281, 2320, 2359, 2398, 2437, 2476, 2515, 2554, 2593, 2632, 2671, 2710, 2749, 2788, 2827, 2866, 2905, 2944, 2983, 3022, 3061, 3100, 3139, 3178, 3217, 3256, 3295, 3334, 3373, 3412, 3451, 3490, 3529, 3568, 3607, 3646, 3685, 3724, 3763, 3802, 3841, 3880, 3919, 3958, 3997, 4036, 4075, 4114, 4153, 4192]
[1369, 1408, 1447, 1486, 1525, 1564, 1603, 1642, 1681, 1720, 1759, 1798, 1837, 1876, 1915, 1954, 1993, 2032, 2071, 2110, 2149, 2188, 2227, 2266, 2305, 2344, 2383, 2422, 2461, 2500, 2539, 2578, 2617, 2656, 2695, 2734, 2773, 2812, 2851, 2890, 2929, 2968, 3007, 3046, 3085, 3124, 3163, 3202, 3241, 3280, 3319, 3358]
[55, 166, 277, 388, 499, 610, 721, 832, 943, 1054, 1165]
61776

In [4]:
volume = numpy.ndarray((len(x), len(y)))

for row in rows:
    volume[row[0], row[1]] += row[-1]

In [5]:
print volume


[[ 0.  0.  0. ...,  0.  0.  0.]
 [ 0.  0.  0. ...,  0.  0.  0.]
 [ 0.  0.  0. ...,  0.  0.  0.]
 ..., 
 [ 0.  0.  0. ...,  0.  0.  0.]
 [ 0.  0.  0. ...,  0.  0.  0.]
 [ 0.  0.  0. ...,  0.  0.  0.]]

In [ ]:
plt.imshow(volume)
plt.show()